<table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td>&nbsp;</td>
            </tr>
          <tr>
            <td>
      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="250" rowspan="5" align="left" valign="top"><img src="<!--ImageURL--><?php echo $FLAG;?>" width="200" height="400"></td>
          <td align="center" valign="top">
            <table width="90%"  border="0" cellpadding="0" cellspacing="0" class="table5">
              <tr>
                <td width="100%" height="20" class="table4">
                  <div align="center">
                    <?php echo $SLANG[sqpanel][$lang][changeinfo];?>
                  </div>
                </td>
                <td width="40" rowspan="2"><img src="<!--ImageURL--><?php echo $ICON;?>" width="40" height="40"></td>
              </tr>
              <tr>
                <td height="20" class="back5">&nbsp;</td>
              </tr>
              <tr valign="middle">
                <td height="20" colspan="2" align="center">
                  <table width="90%"  border="0" cellpadding="0" cellspacing="0">
                    <form method=post enctype="multipart/form-data">

                      <tr valign="middle" class="table5">
                        <td width="10" height="30" align="center">&nbsp;</td>
                        <input type=hidden name=changeinfo value=1>
                        <td width="200" align="center">
                          <div align="right">
                            <input name="dvname" type="text" class="form2" value="<?php echo $VARS[division][name]?>">
                          </div>
                        </td>
                        <td width="20" align="center">&nbsp;</td>
                        <td align="center">
                          <div align="left">
                            <?php echo $SLANG[sqpanel][$lang][divisionname];?>
                          </div>
                        </td>
                      </tr>

                      <tr valign="middle" class="table5">
                        <td width="10" height="30" align="center">&nbsp;</td>
                        <input type=hidden name=changeinfo value=1>
                        <td width="200" align="center">
                          <div align="right">
                            <input name="dvtag" type="text" class="form2" value="<?php echo $VARS[division][tag]?>">
                          </div>
                        </td>
                        <td width="20" align="center">&nbsp;</td>
                        <td align="center">
                          <div align="left">
                            <?php echo $SLANG[sqpanel][$lang][dvtag];?>
                          </div>
                        </td>
                      </tr>

                      <tr valign="middle" class="table5">
                        <td height="30" align="center">&nbsp;</td>
                        <td align="center">
                          <div align="right">
                            <input name="dvhomepage" type="text" class="form2" value="<?php echo $VARS[division][divisionpage]?>">
                          </div>
                        </td>
                        <td align="center">&nbsp;</td>
                        <td align="center">
                          <div align="left">
                            <?php echo $SLANG[sqpanel][$lang][homepage];?>
                          </div>
                        </td>
                      </tr>

                      <tr valign="middle" class="table5">
                        <td height="30" align="center">&nbsp;</td>
                        <td align="center">
                          <div align="right">
                            <select NAME=xoname CLASS=form2>
<?php
	$pilots = GetDivisionCoAndXo($VARS[division][id]);
    foreach ($pilots as $pilot) {

    	if ($pilot[callsign] == $VARS[division][xoname])
        	echo "<option value='".$pilot[callsign]."' selected>".$pilot[callsign]."</option>";
        else
        	echo "<option value='".$pilot[callsign]."'>".$pilot[callsign]."</option>";
	}
?>
                          </select>
                          </div>
                        </td>
                        <td align="center">&nbsp;</td>
                        <td align="center">
                          <div align="left">
                            <?php echo $SLANG[sqpanel][$lang][xo];?>
                          </div>
                        </td>
                      </tr>
                      <tr valign="middle" class="table5">
                        <td height="30" align="center">&nbsp;</td>
                        <td align="center">
                          <div align="right">
                            <input name="sqpass" type="password" class="form2">
                          </div>
                        </td>
                        <td align="center">&nbsp;</td>
                        <td align="center">
                          <div align="left">
                            <?php echo $SLANG[sqpanel][$lang][divisionpassword];?>
                          </div>
                        </td>
                      </tr>
                      <tr valign="middle" class="table5">
                        <td height="30" align="center">&nbsp;</td>
                        <td align="center">
                          <div align="right">
                            <input name="sqpass2" type="password" class="form2">
                          </div>
                        </td>
                        <td align="center">&nbsp;</td>
                        <td align="center">
                          <div align="left">
                            <?php echo $SLANG[sqpanel][$lang][retypedivisionpassword];?>
                          </div>
                        </td>
                      </tr>
                      <tr valign="middle" class="table5">
                        <td height="30" align="center">&nbsp;</td>
                        <td align="center">
                          <div ALIGN="RIGHT">
                            <select NAME=addsquad CLASS=form2>
                              <?php
	$squads = GetAllFreeSquads($VARS[division][army]);
echo "<option value='-'>-</option>";
    foreach ($squads as $squad) {
        	echo "<option value='".$squad[name]."'>".$squad[name]."</option>";
	}


?>
                            </select>
                          </div>
                        </td>
                        <td align="center">&nbsp;</td>
                        <td align="left">
                          <?php echo $SLANG[sqpanel][$lang][addtodivision];?>
                        </td>
                      </tr>
                      <tr valign="middle" class="table5">
                        <td height="30" align="center">&nbsp;</td>
                        <td align="center">
                          <div ALIGN="RIGHT">
                            <select NAME=delsquad CLASS=form2>
                              <?php
	$squads = GetDivisionSquads($VARS[division][id]);
    echo "<option value='-'>-</option>";
	foreach ($squads as $squad) {
        	echo "<option value='".$squad[name]."'>".$squad[name]."</option>";
	}


?>
                            </select>
                          </div>
                        </td>
                        <td align="center">&nbsp;</td>
                        <td align="left">
                          <?php echo $SLANG[sqpanel][$lang][delfromdivision];?>
                        </td>
                      </tr>
                      <tr valign="middle" class="table5">
                        <td height="30" align="center">&nbsp;</td>
                        <td align="center">
                          <div ALIGN="RIGHT"> </div>
                        </td>
                        <td align="center">&nbsp;</td>
                        <td align="left">
                          <div ALIGN="LEFT"></div>
                        </td>
                      </tr>
                      <tr valign="middle" class="table5">
                        <td height="30" align="center">&nbsp;</td>
                        <td align="center">
                          <div align="right">
                            <input name="dopost" type="submit" class="form4" value="<?php echo $SLANG[sqpanel][$lang][commit];?>">
                          </div>
                        </td>
                        <td align="center">&nbsp;</td>
                        <td align="center">
                          <div align="left"></div>
                        </td>
                      </tr>
                    </form>
                  </table>
                </td>
              </tr>
              <tr valign="middle">
                <td height="20" colspan="2" align="center">&nbsp;</td>
              </tr>
            </table>
          </td>
        </tr>
        <tr>
          <td align="center" valign="top" HEIGHT="20">&nbsp;</td>
        </tr>
        <tr>
          <td align="center" valign="top">
            <table WIDTH="90%"  BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="table5">
              <tr>
                <td WIDTH="100%" HEIGHT="20" CLASS="table4">
                  <div ALIGN="center">
                    <?php echo $SLANG[sqpanel][$lang][divisioninfo];?>
                  </div>
                </td>
                <td WIDTH="40" ROWSPAN="2"><img SRC="<!--ImageURL--><?php echo $ICON;?>" WIDTH="40" HEIGHT="40"></td>
              </tr>
              <tr>
                <td HEIGHT="20" CLASS="back5">&nbsp;</td>
              </tr>
              <tr VALIGN="middle">
                <td HEIGHT="48" COLSPAN="2" ALIGN="center">
                  <table WIDTH="90%"  BORDER="0" CELLPADDING="0" CELLSPACING="0">
                    <tr VALIGN="middle" CLASS="table5">
                      <td WIDTH="10" HEIGHT="30" ALIGN="center">&nbsp;</td>
                      <input TYPE=hidden NAME=changeinfo2 VALUE=1>
                      <td WIDTH="200" ALIGN="center">
                        <div ALIGN="right">
                          <?php echo $SLANG[sqpanel][$lang][squadindivision];?>
                        </div>
                      </td>
                      <td WIDTH="20" ALIGN="center">&nbsp;</td>
                      <td ALIGN="center">
                        <div ALIGN="left">
                          <?php echo implode(", ",$VARS[indivision][squads]);?>
                        </div>
                      </td>
                    </tr>
                    <tr VALIGN="middle" CLASS="table5">
                      <td WIDTH="10" HEIGHT="30" ALIGN="center">&nbsp;</td>
                      <input TYPE=hidden NAME=changeinfo2 VALUE=1>
                      <td WIDTH="200" ALIGN="center">
                        <div ALIGN="right">
                          <?php echo $SLANG[sqpanel][$lang][squadwaitdivision];?>
                        </div>
                      </td>
                      <td WIDTH="20" ALIGN="center">&nbsp;</td>
                      <td ALIGN="center">
                        <div ALIGN="left">
                          <?php echo @implode(", ",$VARS[waitdivision][squads]);?>
                        </div>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
              <tr VALIGN="middle">
                <td HEIGHT="20" COLSPAN="2" ALIGN="center">&nbsp;</td>
              </tr>
            </table>
          </td>
        </tr>








              <tr>
                <td align="center" valign="top">&nbsp;</td>
              </tr>
              <tr>
                <td align="center" valign="top"><table width="90%"  border="0" cellpadding="0" cellspacing="0" class="table5">
                  <tr>
                    <td width="100%" height="20" class="table4"><div align="center"><?php echo $SLANG[sqpanel][$lang][rebase];?></div></td>
                    <td width="40" rowspan="2"><img src="<!--ImageURL--><?php echo $ICON;?>" width="40" height="40"></td>
                  </tr>
                  <tr>
                    <td height="20" class="back5">&nbsp;</td>
                  </tr>
                  <tr valign="middle">
                    <td height="20" colspan="2" align="center"><table width="90%"  border="0" cellspacing="0" cellpadding="0">
                        <tr valign="middle" class="table5">
                          <td width="10" height="20" align="center">&nbsp;</td>
                          <td width="200" align="center"><div align="right"><?php echo $SLANG[sqpanel][$lang][currentbase];?></div></td>
                          <td width="20" align="center">&nbsp;</td>
                          <td align="center"><div align="left"><?php echo $VARS[basestatus][field][name]?></div></td>
                        </tr>
                        <tr valign="middle" class="table5">
                          <td height="20" align="center">&nbsp;</td>
                          <td align="center">
                            <div align="right"><?php echo $SLANG[sqpanel][$lang][fuelamount];?></div></td>
                          <td align="center">&nbsp;</td>
                          <td align="center"><div align="left"><?php echo $VARS[basestatus][field][fuel];?> <?php echo $SLANG[sqpanel][$lang][tonn];?></div></td>
                        </tr>
                        <tr valign="middle" class="table5">
                          <td height="20" align="center">&nbsp;</td>
                          <td align="center">
                            <div align="right"><?php echo $SLANG[sqpanel][$lang][ammoamount];?>                           </div></td>
                          <td align="center">&nbsp;</td>
                          <td align="center"><div align="left"><?php echo $VARS[basestatus][field][ammo];?> <?php echo $SLANG[sqpanel][$lang][tonn];?></div></td>
                        </tr>
                        <tr valign="middle" class="table5">
                          <td height="20" align="center">&nbsp;</td>
                          <td align="center">
                            <div align="right"><?php echo $SLANG[sqpanel][$lang][repairamount];?>                           </div></td>
                          <td align="center">&nbsp;</td>
                          <td align="center"><div align="left"><?php echo $VARS[basestatus][field][repair];?> <?php echo $SLANG[sqpanel][$lang][sht];?></div></td>
                        </tr>
                        <tr valign="middle" class="table5">
                          <td height="20" align="center">&nbsp;</td>
                          <td align="center">
                            <div align="right"><?php echo $SLANG[sqpanel][$lang][squadsonfield];?>                           </div></td>
                          <td align="center">&nbsp;</td>
                          <td align="center"><div align="left">
	                          <?php echo @implode(", ",$VARS[basestatus][squads]);?>
                          </div></td>
                        </tr>
                        <tr valign="middle" class="table5">
                          <td height="20" align="center">&nbsp;</td>
                          <td align="center">&nbsp;</td>
                          <td align="center">&nbsp;</td>
                          <td align="center">&nbsp;</td>
                        </tr>
                        <tr valign="middle" class="table5">
                          <td height="20" align="center">&nbsp;</td>
<form method=post>

<input type=hidden name=changefield value=1>

                          <td align="center"><div align="right">
                <?php

	            $fields_r = mysql_query("select * from fields_discr where army='$division[army]'");

	            while ($field = mysql_fetch_assoc($fields_r)) {

                	$ftype_r = mysql_query("select * from fields_types where id='$field[type]'");
                    $ftype = mysql_fetch_assoc($ftype_r);


                    	if ($field[ammo] / $ftype[ammo] >= 0.2 and $field[fuel] / $ftype[fuel] >= 0.2) {

                        	$fpostponed_r = mysql_query("select * from postponed where
                            	query LIKE \"update squadrons set fieldid='".$field[id]."' where id='".$co_squad."'\" and isupdated=0 order by id DESC LIMIT 0,1");

                            if (mysql_num_rows($fpostponed_r))
	                            $fpostponed = mysql_num_rows($fpostponed_r);

                       }

                }

				if ($fpostponed)
                	echo "<span class=\"text7\">".$SLANG[sqpanel][$lang][rebaseinprogress]."</span>";
                else
       				echo "<input name=\"dopost\" type=\"submit\" class=\"form4\" value=\"".$SLANG[sqpanel][$lang][dorebase]."\">";


                ?>

                          </div></td>
                          <td align="center">&nbsp;</td>
                          <td align="center"><div align="left"><?php echo $SLANG[sqpanel][$lang][dorebasecomment];?></div></td>
                        </tr>
                        <tr valign="middle" class="table5">
                          <td height="20" colspan="4" align="center">
                              <div align="left">                              </div></td>
                          </tr>
                        <tr valign="middle" class="table5">
                          <td colspan="4" align="center">
                          <table width="80%"  border="0" cellspacing="0" cellpadding="0">

                <?php

	            $fields_r = mysql_query("select * from fields_discr where army='$division[army]'");

	            while ($field = mysql_fetch_assoc($fields_r)) {

                	$ftype_r = mysql_query("select * from fields_types where id='$field[type]'");
                    $ftype = mysql_fetch_assoc($ftype_r);

                	?>
                            <tr>
                              <td>
                              	<div align="left">
                	<?php
                    	//echo "$field[ammo] / $ftype[ammo] >= 0.2 and $field[fuel] / $ftype[fuel] >= 0.2<br>";
                    	if ($field[ammo] / $ftype[ammo] >= 0.2 and $field[fuel] / $ftype[fuel] >= 0.2) {


                        	$fpostponed_r = mysql_query("select * from postponed where
                            	query LIKE \"update squadrons set fieldid='".$field[id]."' where id='".$co_squad."'\" and isupdated=0 order by id DESC LIMIT 0,1");

                            $fpostponed = mysql_num_rows($fpostponed_r);

                            if ($field[id] == $field_id)
	                            echo "<input name=\"fieldid\" type=\"radio\" value=\"$field[id]\" checked>
	                                  $field[name]
	                                 ";
	                        else
	                            echo "<input name=\"fieldid\" type=\"radio\" value=\"$field[id]\">
	                                  $field[name]
	                                 ";

                            if ($fpostponed) {
								echo "<span class=\"text7\"> (Fuel: $field[fuel] Ammo: $field[ammo] R.k: $field[repair])</span>";
                            }
                            else
								echo "(Fuel: $field[fuel] Ammo: $field[ammo] R.k: $field[repair])";
                       }
                       else {
								echo "<input name=\"fieldid\" type=\"radio\" value=\"\"><span class=\"text6\">$field[name] (Fuel: $field[fuel] Ammo: $field[ammo] R.k: $field[repair])</span>";
                       }

                	?>
                                </div>

                                <div align="left">
                                </div>
                              </td>
                            </tr>
                <?php
	   			}
                ?>

</form>

                          </table>                            </td>
                        </tr>
                        <tr valign="middle" class="table5">
                          <td colspan="4" align="center">&nbsp;</td>
                        </tr>

                    </table></td>
                  </tr>
                  <tr valign="middle">
                    <td height="20" colspan="2" align="center">&nbsp;</td>
                  </tr>
                </table>                  </td>
              </tr>
              <tr>
                <td align="center" valign="top">&nbsp;</td>
              </tr>










        <tr>
          <td align="center" valign="top">&nbsp;</td>
        </tr>
        <tr>
          <td align="center" valign="top">&nbsp; </td>
        </tr>
        <tr valign="middle">
          <td colspan="4" align="center">&nbsp;</td>
        </tr>
        <tr valign="middle">
          <td align="center">&nbsp;</td>
          <td align="center">&nbsp;</td>
          <td align="center">&nbsp;</td>
          <td align="center">
            <div align="left"></div>
          </td>
        </tr>
      </table>
    </td>


                  </tr>
                  <tr valign="middle">
                    <td height="20" colspan="2" align="center">&nbsp;</td>
                  </tr>
                </table>




